<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/plu/layui/css/layui.css">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        body {
            padding: 16px;
        }
    </style>
</head>
<body>
<script src="/plu/layui/layui.js"></script>
<script>
    layui.use("form",function (){
        layui.form.on("submit(submit)",function (data){
            layui.jquery.ajax({
                url:"/s/account/add?no="+data.field.no+"&name="+
                    data.field.name+"&gender="+data.field.sex,
                //提交方式
                type:"GET",
                //成功回调
                success:function (data){
                    if (data==="1"){
                        //代表后端返回数据正常，数据成功写入数据库了
                        alert("添加成功")
                        window.close();
                        return;
                    }
                    alert(data);
                },
                //回调失败
                error:function (data){
                    alert("接口异常，请稍后再试~")
                }
            });
            return false;
        })
    })
</script>
</body>
</html>